package com.syni.mdd.yhd.common.all.controller.protect;

/**
 * @className BmsBusinessController
 * @description TOO
 * @Author cfx
 * @DATE 2019/4/15 14:25
 * @VERSION 1.0
 **/

import com.syni.mdd.sjb.common.component.utils.common.annotations.EntranceCheck;
import com.syni.mdd.yhd.common.all.dto.requestDto.BmsDxFoodLibraryReDto;
import com.syni.mdd.yhd.common.all.dto.requestDto.BmsDxSubFoodReDto;
import com.syni.mdd.yhd.common.all.service.impl.BmsDxFoodLibraryServiceImpl;
import com.syni.mdd.yhd.common.all.validationGroup.GroupCheckPaging;
import com.syni.mdd.yhd.common.all.validationGroup.GroupDelete;
import com.syni.mdd.yhd.common.all.validationGroup.GroupFind;
import com.syni.mdd.yhd.common.all.validationGroup.GroupInsert;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/dxFoodLibrary")
public class BmsDxFoodLibraryController {
    @Autowired
    BmsDxFoodLibraryServiceImpl bmsDxFoodLibraryService;

    @PostMapping("/getFoodLibraryType")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> getFoodLibraryType(@RequestBody @Validated({GroupCheckPaging.class, GroupFind.class}) BmsDxFoodLibraryReDto bmsDxFoodLibraryReDto){
        return bmsDxFoodLibraryService.getFoodLibraryType(bmsDxFoodLibraryReDto);
    }

    @PostMapping("/addFoodLibraryType")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> addFoodLibraryType(@RequestBody @Validated({GroupFind.class, GroupInsert.class}) BmsDxFoodLibraryReDto bmsDxFoodLibraryReDto){
        return bmsDxFoodLibraryService.addFoodLibraryType(bmsDxFoodLibraryReDto);
    }

    @PostMapping("/deleteFoodLibraryType")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> deleteFoodLibraryType(@RequestBody @Validated({GroupDelete.class}) BmsDxFoodLibraryReDto bmsDxFoodLibraryReDto){
        return bmsDxFoodLibraryService.deleteFoodLibraryType(bmsDxFoodLibraryReDto);
    }

    @PostMapping("/addDxSubFood")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> addDxSubFood(@RequestBody @Validated({GroupFind.class, GroupInsert.class}) BmsDxSubFoodReDto bmsDxSubFoodReDto){
        return bmsDxFoodLibraryService.addDxSubFood(bmsDxSubFoodReDto);
    }

    @PostMapping("/getDxSubFood")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> getDxSubFood(@RequestBody @Validated({GroupCheckPaging.class,GroupFind.class}) BmsDxSubFoodReDto bmsDxSubFoodReDto){
        return bmsDxFoodLibraryService.getDxSubFood(bmsDxSubFoodReDto);
    }

    @PostMapping("/deleteDxSubFood")
    @EntranceCheck(checkAuth = true)
    public Map<String,Object> deleteDxSubFood(@RequestBody BmsDxSubFoodReDto bmsDxSubFoodReDto){
        return bmsDxFoodLibraryService.deleteDxSubFood(bmsDxSubFoodReDto);
    }


    @PostMapping("/getBusinessAllFood")
    @EntranceCheck
    public Map<String,Object> getBusinessAllFood(@RequestBody BmsDxSubFoodReDto bmsDxSubFoodReDto){
        return bmsDxFoodLibraryService.getBusinessAllFood(bmsDxSubFoodReDto);
    }
}
